Skip to content

Conversation

@nkomonen-amazon
Copy link
Contributor

@nkomonen-amazon nkomonen-amazon commented Oct 15, 2024

Problem:

This test was flaky due to the event emitter and the test expecting 2 of the same event to come in, but sometimes the second one was not capture.

This looks to be due to the second captureEventOnce call needing to do some initial setup before it could capture an event. And I think there was a race condition between it being setup in time and the event being emitted before it could start listening.

Solution:

Make a new function which does the event capture once and then listens N amount of times. This is reliable.

fix #5681


License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

This test was flaky due to the event emitter and the test expecting 2
of the same event to come in, but sometimes the second one was not capture.

This looks to be due to the second `captureEventOnce` call needing to do some
initial setup before it could capture an event. And I think there was a
race condition between it being setup in time and the event being emitted before
it could start listening.

Solution:

Make a new function which does the event capture once and then listens N
amount of times. This is reliable.

Signed-off-by: nkomonen-amazon <[email protected]>
@nkomonen-amazon nkomonen-amazon requested a review from a team as a code owner October 15, 2024 19:50
@github-actions
Copy link

This pull request implements a feature or fix, so it must include a changelog entry. See CONTRIBUTING.md#changelog for instructions.

Copy link
Contributor

@justinmk3 justinmk3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice approach and explanation

@justinmk3 justinmk3 changed the title fix(test): flaky auth test fix(test): unreliable test "AuthUtil CodeWhisperer uses fallback connection" Oct 15, 2024
@justinmk3 justinmk3 merged commit ebcb987 into aws:master Oct 15, 2024
16 of 35 checks passed
@nkomonen-amazon nkomonen-amazon deleted the authTestFix branch October 15, 2024 21:51
tverney pushed a commit to tverney/aws-toolkit-vscode that referenced this pull request Oct 21, 2024
aws#5788

## Problem:

This test was flaky due to the event emitter and the test expecting 2 of
the same event to come in, but sometimes the second one was not capture.

This looks to be due to the second `captureEventOnce` call needing to do
some initial setup before it could capture an event. And I think there
was a race condition between it being setup in time and the event being
emitted before it could start listening.

## Solution:

Make a new function which does the event capture once and then listens N
amount of times. This is reliable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unreliable test: "AuthUtil CodeWhisperer uses fallback connection" (timeout?)

2 participants